package adapter;

import android.support.annotation.Nullable;
import android.widget.Button;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import bean.CourseInfo02Bean;
import student.andlei.com.student.R;


public class TimetableFragmentPrepareAdapter extends BaseQuickAdapter<CourseInfo02Bean,BaseViewHolder> {
    public TimetableFragmentPrepareAdapter(int layoutResId, @Nullable List<CourseInfo02Bean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CourseInfo02Bean item) {
        helper.setText(R.id.tv_rc_subject_timetable,item.room_name);
        helper.setText(R.id.tv_rc_schoollocation_timetable,item.schedule_name);
        helper.setText(R.id.tv_rc_coursetime_timetable,item.start_time+"---"+item.end_time);
        helper.setText(R.id.tv_rc_teachername_timetable,item.teacher_name+"老师");

        Button button = helper.getView(R.id.bt_rc_entercourse_timetable);
        Button button2 = helper.getView(R.id.bt_rc_prepare_timetable);
        helper.addOnClickListener(R.id.bt_rc_entercourse_timetable);
        helper.addOnClickListener(R.id.bt_rc_prepare_timetable);
        //1:结束 0:未结束
//        if(item.is_over ==1){
//            button.setText("查看录播");
//            button.setBackgroundResource(R.drawable.bt_yellow_click);
//            button2.setText("复习");
//        }else {
//            button.setText("进入课堂");
//            button.setBackgroundResource(R.drawable.bt_click);
//            button2.setText("预习");
//        }
        //1:预习 2:复习
        switch (item.status){
            case 1:
                button2.setText("预习");
                break;
            case 2:
                button2.setText("复习");
                break;
        }
        //1:暂未开始 2:进入课堂 3.查看录播 4：录播暂未上传
        switch (item.classroom_status){
            case 1:
                button.setBackgroundResource(R.drawable.bt_yellow_click);
                button.setText("进入课堂");
                break;
            case 2:
                button.setBackgroundResource(R.drawable.bt_yellow_click);
                button.setText("进入课堂");
                break;
            case 3:
                button.setBackgroundResource(R.drawable.bt_click);
                button.setText("查看录播");
                break;
            case 4:
                button.setBackgroundResource(R.drawable.bt_click);
                button.setText("查看录播");
                break;
        }
        ImageView imageView = helper.getView(R.id.img_class_type);
        //1:校内课程 2:校内辅导课程 3:校外课程
        switch (item.room_type){
            case 1:
                imageView.setImageResource(R.mipmap.putong);
                break;
            case 2:
                imageView.setImageResource(R.mipmap.kewai);
                break;
            case 3:
                imageView.setImageResource(R.mipmap.xiaowai);
                break;
        }
//        helper.setText(R.id.bt_rc_entercourse_all,item.getCourseSubjects());
//        helper.getView(R.id.bt_rc_prepare_all);
    }
}
